﻿using UnityEngine;
using System.Collections;

public class EPScrollSound : ObjectBase
{
    Vector3 m_SvPrePos = Vector3.zero;
    public void OnDrag(Vector2 delta)
    {
        UIDragScrollView sv = GetComp("UIDragScrollView") as UIDragScrollView;
        if (sv != null && sv.scrollView != null) // 스크롤이 가능한 상태
        {
            if (sv.scrollView.transform.localPosition != m_SvPrePos)
            {
                m_SvPrePos = sv.scrollView.transform.localPosition;

                if (!SoundController.IsPlaying(gameObject))
                {
                    SoundController.PlaySound(gameObject, "UI_button_scroll");
                }
            }
        }
    }

    public void OnPress(bool isPress)
    {
        if (isPress)
        {
            UIDragScrollView sv = GetComp("UIDragScrollView") as UIDragScrollView;
            if (sv != null && sv.scrollView != null) // 스크롤이 가능한 상태
            {
                m_SvPrePos = sv.scrollView.transform.localPosition;
            }
        }
    }
}
